All global names visible in libwiggle now start 'wiggle_'.
This makes conflicts less likely.
Signed-off-by: NeilBrown <neil@brown.name>
int klo, khi, k;
int f;
- struct v *valloc = xmalloc(sizeof(struct v)*((ahi-alo)+(bhi-blo)+5));
+ struct v *valloc = wiggle_xmalloc(sizeof(struct v)*((ahi-alo)+(bhi-blo)+5));
struct v *v = valloc + (bhi-alo+2);
k = klo = khi = alo-blo;
return orig;
rv.elcnt = cnt;
- rv.list = xmalloc(cnt*sizeof(struct elmnt));
+ rv.list = wiggle_xmalloc(cnt*sizeof(struct elmnt));
cnt = 0;
for (i = 0; i < orig.elcnt; i++)
if (!is_skipped(orig.list[i]))
}
}
-struct csl *pdiff(struct file a, struct file b, int chunks)
+struct csl *wiggle_pdiff(struct file a, struct file b, int chunks)
{
struct csl *csl1, *csl2;
- struct best *best = xmalloc(sizeof(struct best)*(chunks+1));
+ struct best *best = wiggle_xmalloc(sizeof(struct best)*(chunks+1));
int i;
struct file asmall, bsmall;
int xmin;
if (best[i].val > 0) {
/* If we there are any newlines in the hunk before
* ylo, then extend xlo back that many newlines if
- * possible and diff_partial the extended regions.
+ * possible and wiggle_diff_partial the extended regions.
*/
int lines = 0;
int ylo = best[i].ylo;
}
while (xlo > xmin && !ends_line(a.list[xlo-1]))
xlo--;
- csl2 = diff_partial(a, b,
+ csl2 = wiggle_diff_partial(a, b,
xlo, best[i].xlo,
ylo, best[i].ylo);
- csl1 = csl_join(csl1, csl2);
+ csl1 = wiggle_csl_join(csl1, csl2);
}
- /* Now diff_partial the good bit of the hunk with the
+ /* Now wiggle_diff_partial the good bit of the hunk with the
* good match
*/
- csl2 = diff_partial(a, b,
+ csl2 = wiggle_diff_partial(a, b,
best[i].xlo, best[i].xhi,
best[i].ylo, best[i].yhi);
- csl1 = csl_join(csl1, csl2);
+ csl1 = wiggle_csl_join(csl1, csl2);
/* Now if there are newlines at the end of the
* hunk that weren't matched, find as many in
- * original and diff_partial those bits
+ * original and wiggle_diff_partial those bits
*/
lines = 0;
yhi = best[i].yhi;
lines -= !!ends_line(a.list[xhi]);
xhi++;
}
- csl2 = diff_partial(a, b,
+ csl2 = wiggle_diff_partial(a, b,
best[i].xhi, xhi,
best[i].yhi, yhi);
- csl1 = csl_join(csl1, csl2);
+ csl1 = wiggle_csl_join(csl1, csl2);
xmin = xhi;
}
} else {
csl2->a = a.elcnt;
csl2->b = b.elcnt;
} else {
- csl1 = xmalloc(sizeof(*csl1));
+ csl1 = wiggle_xmalloc(sizeof(*csl1));
csl1->len = 0;
csl1->a = a.elcnt;
csl1->b = b.elcnt;
int fi, cnt;
struct file sorted;
- sorted.list = xmalloc(sizeof(sorted.list[0]) * ref.elcnt);
+ sorted.list = wiggle_xmalloc(sizeof(sorted.list[0]) * ref.elcnt);
sorted.elcnt = ref.elcnt;
memcpy(sorted.list, ref.list, sizeof(sorted.list[0]) * sorted.elcnt);
qsort(sorted.list, sorted.elcnt, sizeof(sorted.list[0]),
elcmp);
- n.list = xmalloc(sizeof(n.list[0]) * f.elcnt);
+ n.list = wiggle_xmalloc(sizeof(n.list[0]) * f.elcnt);
n.elcnt = 0;
cnt = 0;
for (fi = 0; fi < f.elcnt; fi++) {
* The final element in the list will have 'len' == 0 and will point
* beyond the end of the files.
*/
-struct csl *diff(struct file a, struct file b, int shortest)
+struct csl *wiggle_diff(struct file a, struct file b, int shortest)
{
struct v *v;
struct cslb cslb = {};
af = filter_unique(a, b);
bf = filter_unique(b, a);
- v = xmalloc(sizeof(struct v)*(af.elcnt+bf.elcnt+2));
+ v = wiggle_xmalloc(sizeof(struct v)*(af.elcnt+bf.elcnt+2));
v += bf.elcnt+1;
lcsl(&af, 0, af.elcnt,
/* Alternate entry point - find the common-sub-list in two
* subranges of files.
*/
-struct csl *diff_partial(struct file a, struct file b,
+struct csl *wiggle_diff_partial(struct file a, struct file b,
int alo, int ahi, int blo, int bhi)
{
struct v *v;
struct cslb cslb = {};
- v = xmalloc(sizeof(struct v)*(ahi-alo+bhi-blo+2));
+ v = wiggle_xmalloc(sizeof(struct v)*(ahi-alo+bhi-blo+2));
v += bhi-alo+1;
lcsl(&a, alo, ahi,
return cslb.csl;
}
-struct csl *csl_join(struct csl *c1, struct csl *c2)
+struct csl *wiggle_csl_join(struct csl *c1, struct csl *c2)
{
int cnt1, cnt2;
int offset = 0;
* line up. So don't do a full diff, but rather find the hunk
* headers and diff the bits between them.
*/
-struct csl *diff_patch(struct file a, struct file b, int shortest)
+struct csl *wiggle_diff_patch(struct file a, struct file b, int shortest)
{
int ap, bp;
struct csl *csl = NULL;
a.list[0].start[0] != '\0' ||
b.list[0].start[0] != '\0')
/* this is not a patch */
- return diff(a, b, shortest);
+ return wiggle_diff(a, b, shortest);
ap = 0; bp = 0;
while (ap < a.elcnt && bp < b.elcnt) {
bp++;
while (bp < b.elcnt &&
b.list[bp].start[0] != '\0');
- cs = diff_partial(a, b, alo, ap, blo, bp);
- csl = csl_join(csl, cs);
+ cs = wiggle_diff_partial(a, b, alo, ap, blo, bp);
+ csl = wiggle_csl_join(csl, cs);
}
return csl;
}
{
struct file a, b;
struct csl *csl;
- struct elmnt *lst = xmalloc(argc*sizeof(*lst));
+ struct elmnt *lst = wiggle_xmalloc(argc*sizeof(*lst));
int arg;
struct v *v;
int ln;
arg++;
}
- csl = diff(a, b, 1);
+ csl = wiggle_diff(a, b, 1);
fixup(&a, &b, csl);
while (csl && csl->len) {
int i;
*cp = from;
}
-int split_patch(struct stream f, struct stream *f1, struct stream *f2)
+int wiggle_split_patch(struct stream f, struct stream *f1, struct stream *f2)
{
struct stream r1, r2;
int chunks = 0;
f1->body = f2->body = NULL;
- r1.body = xmalloc(f.len);
- r2.body = xmalloc(f.len);
+ r1.body = wiggle_xmalloc(f.len);
+ r2.body = wiggle_xmalloc(f.len);
r1.len = r2.len = 0;
func[0] = 0;
state = 0;
} else {
fprintf(stderr, "%s: bad context patch at line %d\n",
- Cmd, lineno);
+ wiggle_Cmd, lineno);
return 0;
}
break;
state = 0;
} else {
fprintf(stderr, "%s: bad context patch/2 at line %d\n",
- Cmd, lineno);
+ wiggle_Cmd, lineno);
return 0;
}
break;
acnt --; bcnt--;
} else {
fprintf(stderr, "%s: bad unified patch at line %d\n",
- Cmd, lineno);
+ wiggle_Cmd, lineno);
return 0;
}
if (acnt <= 0 && bcnt <= 0)
/*
* extract parts of a "diff3 -m" or "wiggle -m" output
*/
-int split_merge(struct stream f, struct stream *f1, struct stream *f2, struct stream *f3)
+int wiggle_split_merge(struct stream f, struct stream *f1, struct stream *f2, struct stream *f3)
{
int state = 0;
char *cp, *end;
f1->body = NULL;
f2->body = NULL;
- r1.body = xmalloc(f.len);
- r2.body = xmalloc(f.len);
- r3.body = xmalloc(f.len);
+ r1.body = wiggle_xmalloc(f.len);
+ r2.body = wiggle_xmalloc(f.len);
+ r3.body = wiggle_xmalloc(f.len);
r1.len = r2.len = r3.len = 0;
cp = f.body;
c = realloc(list[0].body, len+1);
if (c == NULL)
- die("memory allocation");
+ wiggle_die("memory allocation");
list[0].body = c;
c += list[0].len;
c[0] = 0;
}
-static struct stream load_regular(int fd)
+static struct stream wiggle_load_regular(int fd)
{
struct stat stb;
struct stream s;
fstat(fd, &stb);
s.len = stb.st_size;
- s.body = xmalloc(s.len+1);
+ s.body = wiggle_xmalloc(s.len+1);
if (read(fd, s.body, s.len) != s.len)
- die("file read");
+ wiggle_die("file read");
s.body[s.len] = 0;
return s;
}
-static struct stream load_other(int fd)
+static struct stream wiggle_load_other(int fd)
{
struct stream list[10];
int i = 0;
while (1) {
- list[i].body = xmalloc(8192);
+ list[i].body = wiggle_xmalloc(8192);
list[i].len = read(fd, list[i].body, 8192);
if (list[i].len < 0)
- die("file read");
+ wiggle_die("file read");
if (list[i].len == 0)
break;
i++;
return list[0];
}
-struct stream load_segment(FILE *f,
+struct stream wiggle_load_segment(FILE *f,
unsigned int start, unsigned int end)
{
struct stream s;
s.len = end - start;
- s.body = xmalloc(s.len+1);
+ s.body = wiggle_xmalloc(s.len+1);
fseek(f, start, 0);
if (fread(s.body, 1, s.len, f) != (size_t)s.len)
- die("file read");
+ wiggle_die("file read");
/* ensure string is 'nul' terminated - for sscanf */
s.body[s.len] = 0;
return s;
}
-struct stream load_file(char *name)
+struct stream wiggle_load_file(char *name)
{
struct stream s;
struct stat stb;
&prefix_len) >= 2 && prefix_len > 0) {
FILE *f = fopen(name + prefix_len, "r");
if (f) {
- s = load_segment(f, start, end);
+ s = wiggle_load_segment(f, start, end);
fclose(f);
} else {
s.body = NULL;
if (fd < 0)
return s;
}
- check_dir(name, fd);
+ wiggle_check_dir(name, fd);
if (fstat(fd, &stb) == 0) {
if (S_ISREG(stb.st_mode))
- s = load_regular(fd);
+ s = wiggle_load_regular(fd);
else
- s = load_other(fd);
+ s = wiggle_load_other(fd);
}
close(fd);
}
af.list[m->a+i].len) != 0)
return 0;
}
- if (do_trace) {
+ if (wiggle_do_trace) {
printf("already applied %d,%d,%d - %d,%d,%d\n",
m->a, m->b, m->c, m->al, m->bl, m->cl);
printf(" %.10s - %.10s\n", af.list[m->a].start,
(m.c == 0 || ends_line(cf.list[m.c-1])));
}
-int isolate_conflicts(struct file af, struct file bf, struct file cf,
+int wiggle_isolate_conflicts(struct file af, struct file bf, struct file cf,
struct csl *csl1, struct csl *csl2, int words,
struct merge *m, int show_wiggles,
int *wigglesp)
return cnt;
}
-struct ci make_merger(struct file af, struct file bf, struct file cf,
+struct ci wiggle_make_merger(struct file af, struct file bf, struct file cf,
struct csl *csl1, struct csl *csl2, int words,
int ignore_already, int show_wiggles)
{
/* maybe a bit of slack at each end */
l = l * 4 + 10;
- rv.merger = xmalloc(sizeof(struct merge)*l);
+ rv.merger = wiggle_xmalloc(sizeof(struct merge)*l);
a = b = c = c1 = c2 = 0;
i = 0;
rv.merger[i+1].type != End)
rv.merger[i].type = Conflict;
}
- rv.conflicts = isolate_conflicts(af, bf, cf, csl1, csl2, words,
+ rv.conflicts = wiggle_isolate_conflicts(af, bf, cf, csl1, csl2, words,
rv.merger, show_wiggles, &rv.wiggles);
return rv;
}
int lines = 0;
while (len > 0 && start < f->elcnt) {
struct elmnt e = f->list[start];
- printword(out, e);
+ wiggle_printword(out, e);
if (e.start[e.plen-1] == '\n' &&
offset > 0)
lines++;
static const char *conflict_types[] = {
"", " border"," conflict"," wiggle" };
-int print_merge(FILE *out, struct file *a, struct file *b, struct file *c,
+int wiggle_print_merge(FILE *out, struct file *a, struct file *b, struct file *c,
int words, struct merge *merger,
struct merge *mpos, int streampos, int offsetpos)
{
for (m = merger; m->type != End ; m++) {
struct merge *cm;
- if (do_trace)
+ if (wiggle_do_trace)
printf("[%s: %d-%d,%d-%d,%d-%d%s(%d,%d)]\n",
m->type==Unmatched ? "Unmatched" :
m->type==Unchanged ? "Unchanged" :
if (m == mpos)
rv = lineno;
- if (do_trace)
+ if (wiggle_do_trace)
for (cm = m; cm->in_conflict; cm++) {
printf("{%s: %d-%d,%d-%d,%d-%d%s(%d,%d)}%s\n",
cm->type==Unmatched?"Unmatched":
if (m->type == End)
break;
- if (do_trace) {
+ if (wiggle_do_trace) {
printf("<<%s: %d-%d,%d-%d,%d-%d%s(%d,%d)>>\n",
m->type==Unmatched?"Unmatched":
m->type==Unchanged?"Unchanged":
}
-int set_prefix(struct plist *pl, int n, int strip)
+int wiggle_set_prefix(struct plist *pl, int n, int strip)
{
int i;
for (i = 0; i < 4 && i < n && strip < 0; i++)
if (strip < 0) {
fprintf(stderr, "%s: Cannot find files to patch: please specify --strip\n",
- Cmd);
+ wiggle_Cmd);
return 0;
}
for (i = 0; i < n; i++) {
}
if (p == NULL) {
fprintf(stderr, "%s: cannot strip %d segments from %s\n",
- Cmd, strip, pl[i].file);
+ wiggle_Cmd, strip, pl[i].file);
return 0;
}
memmove(pl[i].file, p, strlen(p)+1);
return pl;
}
-struct plist *sort_patches(struct plist *pl, int *np)
+struct plist *wiggle_sort_patches(struct plist *pl, int *np)
{
/* sort the patches, add directory names, and re-sort */
char curr[1024];
return pl;
}
-struct plist *parse_patch(FILE *f, FILE *of, int *np)
+struct plist *wiggle_parse_patch(FILE *f, FILE *of, int *np)
{
/* read a multi-file patch from 'f' and record relevant
* details in a plist.
return plist;
}
-void plist_free(struct plist *pl, int num)
+void wiggle_plist_free(struct plist *pl, int num)
{
int i;
for (i = 0; i < num ; i++)
void add_chunk(struct patch *p, struct file *f, int os, int oe, int ns, int ne)
{
- struct chunk *c = xmalloc(sizeof(struct chunk));
+ struct chunk *c = wiggle_xmalloc(sizeof(struct chunk));
c->patch = p;
c->file = f;
c->old_start = os;
#include "ccan/hash/hash.h"
-static int split_internal(char *start, char *end, int type,
+static int wiggle_split_internal(char *start, char *end, int type,
struct elmnt *list)
{
int cnt = 0;
return cnt;
}
-struct file split_stream(struct stream s, int type)
+struct file wiggle_split_stream(struct stream s, int type)
{
int cnt;
struct file f;
end = s.body+s.len;
c = s.body;
- cnt = split_internal(c, end, type, NULL);
- f.list = xmalloc(cnt*sizeof(struct elmnt));
+ cnt = wiggle_split_internal(c, end, type, NULL);
+ f.list = wiggle_xmalloc(cnt*sizeof(struct elmnt));
- f.elcnt = split_internal(c, end, type, f.list);
+ f.elcnt = wiggle_split_internal(c, end, type, f.list);
return f;
}
#include <stdlib.h>
#include <sys/stat.h>
-char *Cmd = "wiggle";
+char *wiggle_Cmd = "wiggle";
-int do_trace = 0;
+int wiggle_do_trace = 0;
-void *xmalloc(int size)
+void *wiggle_xmalloc(int size)
{
void *rv = malloc(size);
if (size && !rv) {
return rv;
}
-void printword(FILE *f, struct elmnt e)
+void wiggle_printword(FILE *f, struct elmnt e)
{
if (e.start[0])
fprintf(f, "%.*s", e.plen + e.prefix,
}
}
-void die(char *reason)
+void wiggle_die(char *reason)
{
- fprintf(stderr, "%s: fatal error: %s failure\n", Cmd, reason);
+ fprintf(stderr, "%s: fatal error: %s failure\n", wiggle_Cmd, reason);
exit(3);
}
-void check_dir(char *name, int fd)
+void wiggle_check_dir(char *name, int fd)
{
struct stat st;
if (fstat(fd, &st) != 0) {
- fprintf(stderr, "%s: fatal: %s is strange\n", Cmd, name);
+ fprintf(stderr, "%s: fatal: %s is strange\n", wiggle_Cmd, name);
exit(3);
}
if (S_ISDIR(st.st_mode)) {
- fprintf(stderr, "%s: %s is a directory\n", Cmd, name);
+ fprintf(stderr, "%s: %s is a directory\n", wiggle_Cmd, name);
exit(3);
}
}
static int save_merge(struct file a, struct file b, struct file c,
struct merge *merger, char *file, int backup)
{
- char *replacename = xmalloc(strlen(file) + 20);
- char *orignew = xmalloc(strlen(file) + 20);
+ char *replacename = wiggle_xmalloc(strlen(file) + 20);
+ char *orignew = wiggle_xmalloc(strlen(file) + 20);
int fd;
FILE *outfile;
int err = 0;
goto out;
}
outfile = fdopen(fd, "w");
- lineno = print_merge(outfile, &a, &b, &c, 0, merger,
- NULL, 0, 0);
+ lineno = wiggle_print_merge(outfile, &a, &b, &c, 0, merger,
+ NULL, 0, 0);
fclose(outfile);
if (backup && rename(file, orignew) != 0)
err = -2;
return -1;
}
outfile = fdopen(fd, "w");
- lineno = print_merge(outfile, &a, &b, &c, 0, merger,
- mpos, streampos, offsetpos);
+ lineno = wiggle_print_merge(outfile, &a, &b, &c, 0, merger,
+ mpos, streampos, offsetpos);
fclose(outfile);
*filep = fname;
return lineno;
#define prepare_merge(ch) \
do { \
/* FIXME check for errors in the stream */ \
- fm = split_stream(sm, ByWord | ignore_blanks); \
- fb = split_stream(sb, ByWord | ignore_blanks); \
- fa = split_stream(sa, ByWord | ignore_blanks); \
+ fm = wiggle_split_stream(sm, ByWord | ignore_blanks); \
+ fb = wiggle_split_stream(sb, ByWord | ignore_blanks); \
+ fa = wiggle_split_stream(sa, ByWord | ignore_blanks); \
\
if (ch && !just_diff) \
- csl1 = pdiff(fm, fb, ch); \
+ csl1 = wiggle_pdiff(fm, fb, ch); \
else \
- csl1 = diff(fm, fb, 1); \
- csl2 = diff_patch(fb, fa, 1); \
+ csl1 = wiggle_diff(fm, fb, 1); \
+ csl2 = wiggle_diff_patch(fb, fa, 1); \
\
- ci = make_merger(fm, fb, fa, csl1, csl2, 0, 1, 0); \
+ ci = wiggle_make_merger(fm, fb, fa, csl1, csl2, 0, 1, 0); \
for (i = 0; ci.merger[i].type != End; i++) \
ci.merger[i].oldtype = ci.merger[i].type; \
} while(0)
if (f == NULL) {
if (!p->is_merge) {
/* three separate files */
- sb = load_file(p->before);
- sa = load_file(p->after);
+ sb = wiggle_load_file(p->before);
+ sa = wiggle_load_file(p->after);
if (just_diff)
sm = sb;
else
- sm = load_file(p->file);
+ sm = wiggle_load_file(p->file);
} else {
/* One merge file */
- sp = load_file(p->file);
+ sp = wiggle_load_file(p->file);
if (reverse)
- split_merge(sp, &sm, &sa, &sb);
+ wiggle_split_merge(sp, &sm, &sa, &sb);
else
- split_merge(sp, &sm, &sb, &sa);
+ wiggle_split_merge(sp, &sm, &sb, &sa);
free(sp.body);
}
ch = 0;
} else {
- sp = load_segment(f, p->start, p->end);
+ sp = wiggle_load_segment(f, p->start, p->end);
if (p->is_merge) {
if (reverse)
- split_merge(sp, &sm, &sa, &sb);
+ wiggle_split_merge(sp, &sm, &sa, &sb);
else
- split_merge(sp, &sm, &sb, &sa);
+ wiggle_split_merge(sp, &sm, &sb, &sa);
ch = 0;
} else {
if (reverse)
- ch = split_patch(sp, &sa, &sb);
+ ch = wiggle_split_patch(sp, &sa, &sb);
else
- ch = split_patch(sp, &sb, &sa);
+ ch = wiggle_split_patch(sp, &sb, &sa);
if (just_diff)
sm = sb;
else
- sm = load_file(p->file);
+ sm = wiggle_load_file(p->file);
}
free(sp.body);
}
break;
if (answer) {
p->wiggles = 0;
- p->conflicts = isolate_conflicts(
+ p->conflicts = wiggle_isolate_conflicts(
fm, fb, fa, csl1, csl2, 0,
ci.merger, 0, &p->wiggles);
p->chunks = p->conflicts;
endwin();
free_stuff();
do_edit(tempname, lineno);
- sp = load_file(tempname);
+ sp = wiggle_load_file(tempname);
unlink(tempname);
- split_merge(sp, &sm, &sb, &sa);
+ wiggle_split_merge(sp, &sm, &sb, &sa);
if (sp.len == sm.len &&
memcmp(sp.body, sm.body, sm.len) == 0 &&
!p->is_merge) {
/* no conflicts left, so display diff */
free(sm.body);
- sm = load_file(p->file);
+ sm = wiggle_load_file(p->file);
free(sb.body);
sb = sm;
sb.body = memdup(sm.body, sm.len);
ci.merger[curs.pos.m].type = ci.merger[curs.pos.m].oldtype;
else
ci.merger[curs.pos.m].type = next;
- p->conflicts = isolate_conflicts(
+ p->conflicts = wiggle_isolate_conflicts(
fm, fb, fa, csl1, csl2, 0,
ci.merger, 0, &p->wiggles);
refresh = 1;
ci.merger[curs.pos.m].type = ci.merger[curs.pos.m].oldtype;
else
ci.merger[curs.pos.m].type = Changed;
- p->conflicts = isolate_conflicts(
+ p->conflicts = wiggle_isolate_conflicts(
fm, fb, fa, csl1, csl2, 0,
ci.merger, 0, &p->wiggles);
refresh = 1;
break;
} while (!ends_line(e) ||
visible(mode & (RESULT|AFTER), ci.merger, &tpos) < 0);
- p->conflicts = isolate_conflicts(
+ p->conflicts = wiggle_isolate_conflicts(
fm, fb, fa, csl1, csl2, 0,
ci.merger, 0, &p->wiggles);
refresh = 1;
!same_mpos(anchor->pos, pos) ||
anchor->searchlen != searchlen ||
!same_mp(anchor->curs.pos, curs.pos)) {
- struct search_anchor *a = xmalloc(sizeof(*a));
+ struct search_anchor *a = wiggle_xmalloc(sizeof(*a));
a->pos = pos;
a->row = row;
a->start = start;
int ignore_blanks, int just_diff)
{
struct stream s1, s2;
- struct stream s = load_segment(f, pl->start, pl->end);
+ struct stream s = wiggle_load_segment(f, pl->start, pl->end);
struct stream sf;
if (pl->is_merge) {
if (reverse)
- split_merge(s, &sf, &s2, &s1);
+ wiggle_split_merge(s, &sf, &s2, &s1);
else
- split_merge(s, &sf, &s1, &s2);
+ wiggle_split_merge(s, &sf, &s1, &s2);
pl->chunks = 0;
} else {
if (reverse)
- pl->chunks = split_patch(s, &s2, &s1);
+ pl->chunks = wiggle_split_patch(s, &s2, &s1);
else
- pl->chunks = split_patch(s, &s1, &s2);
+ pl->chunks = wiggle_split_patch(s, &s1, &s2);
if (just_diff)
sf = s1;
else
- sf = load_file(pl->file);
+ sf = wiggle_load_file(pl->file);
}
if (sf.body == NULL || s1.body == NULL || s1.body == NULL) {
pl->wiggles = pl->conflicts = -1;
struct file ff, fp1, fp2;
struct csl *csl1, *csl2;
struct ci ci;
- ff = split_stream(sf, ByWord | ignore_blanks);
- fp1 = split_stream(s1, ByWord | ignore_blanks);
- fp2 = split_stream(s2, ByWord | ignore_blanks);
+ ff = wiggle_split_stream(sf, ByWord | ignore_blanks);
+ fp1 = wiggle_split_stream(s1, ByWord | ignore_blanks);
+ fp2 = wiggle_split_stream(s2, ByWord | ignore_blanks);
if (pl->chunks && !just_diff)
- csl1 = pdiff(ff, fp1, pl->chunks);
+ csl1 = wiggle_pdiff(ff, fp1, pl->chunks);
else
- csl1 = diff(ff, fp1, 1);
- csl2 = diff_patch(fp1, fp2, 1);
- ci = make_merger(ff, fp1, fp2, csl1, csl2, 0, 1, 0);
+ csl1 = wiggle_diff(ff, fp1, 1);
+ csl2 = wiggle_diff_patch(fp1, fp2, 1);
+ ci = wiggle_make_merger(ff, fp1, fp2, csl1, csl2, 0, 1, 0);
pl->wiggles = ci.wiggles;
pl->conflicts = ci.conflicts;
free(ci.merger);
struct csl *csl1, *csl2;
struct ci ci;
int chunks;
- sp = load_segment(f, pl->start,
+ sp = wiggle_load_segment(f, pl->start,
pl->end);
if (reverse)
- chunks = split_patch(sp, &sa, &sb);
+ chunks = wiggle_split_patch(sp, &sa, &sb);
else
- chunks = split_patch(sp, &sb, &sa);
- fb = split_stream(sb, ByWord | ignore_blanks);
- fa = split_stream(sa, ByWord | ignore_blanks);
- sm = load_file(pl->file);
- fm = split_stream(sm, ByWord | ignore_blanks);
- csl1 = pdiff(fm, fb, chunks);
- csl2 = diff_patch(fb, fa, 1);
- ci = make_merger(fm, fb, fa, csl1, csl2, 0, 1, 0);
+ chunks = wiggle_split_patch(sp, &sb, &sa);
+ fb = wiggle_split_stream(sb, ByWord | ignore_blanks);
+ fa = wiggle_split_stream(sa, ByWord | ignore_blanks);
+ sm = wiggle_load_file(pl->file);
+ fm = wiggle_split_stream(sm, ByWord | ignore_blanks);
+ csl1 = wiggle_pdiff(fm, fb, chunks);
+ csl2 = wiggle_diff_patch(fb, fa, 1);
+ ci = wiggle_make_merger(fm, fb, fa, csl1, csl2, 0, 1, 0);
return save_merge(fm, fb, fa, ci.merger,
pl->file, backup);
}
else {
/* rename foo.porig to foo, and clear is_merge */
char *file = pl[pos].file;
- char *orignew = xmalloc(strlen(file) + 20);
+ char *orignew = wiggle_xmalloc(strlen(file) + 20);
strcpy(orignew, file);
strcat(orignew, ".porig");
if (rename(orignew, file) == 0) {
if (sig != SIGBUS && sig != SIGSEGV)
exit(2);
else
- /* Otherwise return and die */
+ /* Otherwise return and wiggle_die */
signal(sig, NULL);
}
switch (argc) {
default:
- fprintf(stderr, "%s: too many file names given.\n", Cmd);
+ fprintf(stderr, "%s: too many file names given.\n", wiggle_Cmd);
exit(1);
case 0: /* stdin is a patch or diff */
/* cannot seek, so need to copy to a temp file */
f = tmpfile();
if (!f) {
- fprintf(stderr, "%s: Cannot create temp file\n", Cmd);
+ fprintf(stderr, "%s: Cannot create temp file\n", wiggle_Cmd);
exit(1);
}
- pl = parse_patch(stdin, f, &num_patches);
+ pl = wiggle_parse_patch(stdin, f, &num_patches);
in = f;
} else {
- pl = parse_patch(stdin, NULL, &num_patches);
+ pl = wiggle_parse_patch(stdin, NULL, &num_patches);
in = fdopen(dup(0), "r");
}
/* use stderr for keyboard input */
dup2(2, 0);
if (!just_diff &&
- set_prefix(pl, num_patches, strip) == 0) {
- fprintf(stderr, "%s: aborting\n", Cmd);
+ wiggle_set_prefix(pl, num_patches, strip) == 0) {
+ fprintf(stderr, "%s: aborting\n", wiggle_Cmd);
exit(2);
}
- pl = sort_patches(pl, &num_patches);
+ pl = wiggle_sort_patches(pl, &num_patches);
main_window(pl, num_patches, in, reverse, replace, ignore_blanks,
just_diff, backup);
- plist_free(pl, num_patches);
+ wiggle_plist_free(pl, num_patches);
fclose(in);
break;
case 1: /* a patch/diff, a .rej, or a merge file */
f = fopen(argv[0], "r");
if (!f) {
- fprintf(stderr, "%s: cannot open %s\n", Cmd, argv[0]);
+ fprintf(stderr, "%s: cannot open %s\n", wiggle_Cmd, argv[0]);
exit(1);
}
- check_dir(argv[0], fileno(f));
+ wiggle_check_dir(argv[0], fileno(f));
if (patch) {
- pl = parse_patch(f, NULL, &num_patches);
- if (!just_diff && set_prefix(pl, num_patches, strip) == 0) {
- fprintf(stderr, "%s: aborting\n", Cmd);
+ pl = wiggle_parse_patch(f, NULL, &num_patches);
+ if (!just_diff && wiggle_set_prefix(pl, num_patches, strip) == 0) {
+ fprintf(stderr, "%s: aborting\n", wiggle_Cmd);
exit(2);
}
- pl = sort_patches(pl, &num_patches);
+ pl = wiggle_sort_patches(pl, &num_patches);
main_window(pl, num_patches, f, reverse, replace,
ignore_blanks, just_diff, backup);
- plist_free(pl, num_patches);
+ wiggle_plist_free(pl, num_patches);
} else if (strlen(argv[0]) > 4 &&
strcmp(argv[0]+strlen(argv[0])-4, ".rej") == 0) {
char *origname = strdup(argv[0]);
}
f = fopen(argv[1], "r");
if (!f) {
- fprintf(stderr, "%s: cannot open %s\n", Cmd, argv[0]);
+ fprintf(stderr, "%s: cannot open %s\n", wiggle_Cmd, argv[0]);
exit(1);
}
- check_dir(argv[1], fileno(f));
+ wiggle_check_dir(argv[1], fileno(f));
show_merge(argv[0], f, reverse, 0, NULL, NULL,
replace, outfilename,
selftest, ignore_blanks, just_diff, backup);
if (argc == 0) {
fprintf(stderr,
- "%s: no file given for --extract\n", Cmd);
+ "%s: no file given for --extract\n", wiggle_Cmd);
return 2;
}
if (argc > 1) {
fprintf(stderr,
- "%s: only give one file for --extract\n", Cmd);
+ "%s: only give one file for --extract\n", wiggle_Cmd);
return 2;
}
- f = load_file(argv[0]);
+ f = wiggle_load_file(argv[0]);
if (f.body == NULL) {
fprintf(stderr,
- "%s: cannot load file '%s' - %s\n", Cmd,
+ "%s: cannot load file '%s' - %s\n", wiggle_Cmd,
argv[0], strerror(errno));
return 2;
}
if (ispatch) {
- if (split_patch(f, &flist[0], &flist[1]) == 0) {
+ if (wiggle_split_patch(f, &flist[0], &flist[1]) == 0) {
fprintf(stderr,
- "%s: No chunk found in patch: %s\n", Cmd,
+ "%s: No chunk found in patch: %s\n", wiggle_Cmd,
argv[0]);
return 0;
}
} else {
- if (!split_merge(f, &flist[0], &flist[1], &flist[2])) {
+ if (!wiggle_split_merge(f, &flist[0], &flist[1], &flist[2])) {
fprintf(stderr,
- "%s: merge file %s looks bad.\n", Cmd,
+ "%s: merge file %s looks bad.\n", wiggle_Cmd,
argv[0]);
return 2;
}
}
if (flist[which-'1'].body == NULL) {
fprintf(stderr,
- "%s: %s has no -%c component.\n", Cmd,
+ "%s: %s has no -%c component.\n", wiggle_Cmd,
argv[0], which);
return 2;
} else {
if (a < csl->a) {
if (fl[0].list[a].start[0]) {
printf("-");
- printword(stdout,
+ wiggle_printword(stdout,
fl[0].list[a]);
}
a++;
} else if (b < csl->b) {
if (fl[1].list[b].start[0]) {
printf("+");
- printword(stdout,
+ wiggle_printword(stdout,
fl[1].list[b]);
}
b++;
fl[1].list[b]);
else {
printf(" ");
- printword(stdout,
+ wiggle_printword(stdout,
fl[0].list[a]);
}
a++;
if (sol) {
printf("-");
for (; a < csl->a ; a++) {
- printword(stdout, fl[0].list[a]);
+ wiggle_printword(stdout, fl[0].list[a]);
if (ends_line(fl[0].list[a])) {
a++;
break;
do {
if (sol)
printf("|");
- printword(stdout, fl[0].list[a]);
+ wiggle_printword(stdout, fl[0].list[a]);
sol = ends_line(fl[0].list[a]);
a++;
} while (a < csl->a);
if (sol) {
printf("+");
for (; b < csl->b ; b++) {
- printword(stdout, fl[1].list[b]);
+ wiggle_printword(stdout, fl[1].list[b]);
if (ends_line(fl[1].list[b])) {
b++;
break;
do {
if (sol)
printf("|");
- printword(stdout, fl[1].list[b]);
+ wiggle_printword(stdout, fl[1].list[b]);
sol = ends_line(fl[1].list[b]);
b++;
} while (b < csl->b);
if (fl[0].list[a].start[0]) {
printf(" ");
for (; a < csl->a+csl->len; a++, b++) {
- printword(stdout, fl[0].list[a]);
+ wiggle_printword(stdout, fl[0].list[a]);
if (ends_line(fl[0].list[a])) {
a++, b++;
break;
printf("|");
}
if (!sol) {
- printword(stdout, fl[0].list[a]);
+ wiggle_printword(stdout, fl[0].list[a]);
if (ends_line(fl[0].list[a]))
sol = 1;
a++;
switch (argc) {
case 0:
- fprintf(stderr, "%s: no file given for --diff\n", Cmd);
+ fprintf(stderr, "%s: no file given for --diff\n", wiggle_Cmd);
return 2;
case 1:
- f = load_file(argv[0]);
+ f = wiggle_load_file(argv[0]);
if (f.body == NULL) {
fprintf(stderr,
- "%s: cannot load file '%s' - %s\n", Cmd,
+ "%s: cannot load file '%s' - %s\n", wiggle_Cmd,
argv[0], strerror(errno));
return 2;
}
chunks1 = chunks2 =
- split_patch(f, &flist[0], &flist[1]);
+ wiggle_split_patch(f, &flist[0], &flist[1]);
if (!flist[0].body || !flist[1].body) {
fprintf(stderr,
- "%s: couldn't parse patch %s\n", Cmd,
+ "%s: couldn't parse patch %s\n", wiggle_Cmd,
argv[0]);
return 2;
}
break;
case 2:
- flist[0] = load_file(argv[0]);
+ flist[0] = wiggle_load_file(argv[0]);
if (flist[0].body == NULL) {
fprintf(stderr,
- "%s: cannot load file '%s' - %s\n", Cmd,
+ "%s: cannot load file '%s' - %s\n", wiggle_Cmd,
argv[0], strerror(errno));
return 2;
}
if (ispatch) {
- f = load_file(argv[1]);
+ f = wiggle_load_file(argv[1]);
if (f.body == NULL) {
fprintf(stderr,
- "%s: cannot load patch '%s' - %s\n", Cmd,
+ "%s: cannot load patch '%s' - %s\n", wiggle_Cmd,
argv[1], strerror(errno));
return 2;
}
if (which == '2')
chunks2 = chunks3 =
- split_patch(f, &flist[2],
+ wiggle_split_patch(f, &flist[2],
&flist[1]);
else
chunks2 = chunks3 =
- split_patch(f, &flist[1],
+ wiggle_split_patch(f, &flist[1],
&flist[2]);
} else
- flist[1] = load_file(argv[1]);
+ flist[1] = wiggle_load_file(argv[1]);
if (flist[1].body == NULL) {
fprintf(stderr,
- "%s: cannot load file '%s' - %s\n", Cmd,
+ "%s: cannot load file '%s' - %s\n", wiggle_Cmd,
argv[1], strerror(errno));
return 2;
}
break;
default:
fprintf(stderr,
- "%s: too many files given for --diff\n", Cmd);
+ "%s: too many files given for --diff\n", wiggle_Cmd);
return 2;
}
if (reverse) {
flist[0] = flist[1];
flist[1] = f;
}
- fl[0] = split_stream(flist[0], obj);
- fl[1] = split_stream(flist[1], obj);
+ fl[0] = wiggle_split_stream(flist[0], obj);
+ fl[1] = wiggle_split_stream(flist[1], obj);
if (!(obj & WholeWord) && fl[0].elcnt > 50000 && fl[1].elcnt > 50000) {
/* Too big - use fewer words if possible */
free(fl[0].list);
free(fl[1].list);
obj |= WholeWord;
- fl[0] = split_stream(flist[0], obj);
- fl[1] = split_stream(flist[1], obj);
+ fl[0] = wiggle_split_stream(flist[0], obj);
+ fl[1] = wiggle_split_stream(flist[1], obj);
}
if (chunks2 && !chunks1)
- csl = pdiff(fl[0], fl[1], chunks2);
+ csl = wiggle_pdiff(fl[0], fl[1], chunks2);
else
- csl = diff_patch(fl[0], fl[1], shortest);
+ csl = wiggle_diff_patch(fl[0], fl[1], shortest);
if ((obj & ByMask) == ByLine) {
if (!chunks1)
printf("@@ -1,%d +1,%d @@\n",
switch (argc) {
case 0:
- fprintf(stderr, "%s: no files given for --merge\n", Cmd);
+ fprintf(stderr, "%s: no files given for --merge\n", wiggle_Cmd);
return 2;
case 3:
case 2:
case 1:
for (i = 0; i < argc; i++) {
- flist[i] = load_file(argv[i]);
+ flist[i] = wiggle_load_file(argv[i]);
if (flist[i].body == NULL) {
fprintf(stderr, "%s: cannot load file '%s' - %s\n",
- Cmd,
+ wiggle_Cmd,
argv[i], strerror(errno));
return 2;
}
break;
default:
fprintf(stderr, "%s: too many files given for --merge\n",
- Cmd);
+ wiggle_Cmd);
return 2;
}
switch (argc) {
case 1: /* a merge file */
f = flist[0];
- if (!split_merge(f, &flist[0], &flist[1], &flist[2])) {
+ if (!wiggle_split_merge(f, &flist[0], &flist[1], &flist[2])) {
fprintf(stderr, "%s: merge file %s looks bad.\n",
- Cmd,
+ wiggle_Cmd,
argv[0]);
return 2;
}
break;
case 2: /* a file and a patch */
f = flist[1];
- chunks2 = chunks3 = split_patch(f, &flist[1], &flist[2]);
+ chunks2 = chunks3 = wiggle_split_patch(f, &flist[1], &flist[2]);
break;
case 3: /* three separate files */
break;
for (i = 0; i < 3; i++) {
if (flist[i].body == NULL) {
- fprintf(stderr, "%s: file %d missing\n", Cmd, i);
+ fprintf(stderr, "%s: file %d missing\n", wiggle_Cmd, i);
return 2;
}
}
outfile = fopen(outfilename, "w");
if (!outfile) {
fprintf(stderr, "%s: could not create %s\n",
- Cmd, outfilename);
+ wiggle_Cmd, outfilename);
return 2;
}
} else if (replace) {
int fd;
- replacename = xmalloc(strlen(argv[0]) + 20);
- orignew = xmalloc(strlen(argv[0]) + 20);
+ replacename = wiggle_xmalloc(strlen(argv[0]) + 20);
+ orignew = wiggle_xmalloc(strlen(argv[0]) + 20);
strcpy(replacename, argv[0]);
strcpy(orignew, argv[0]);
strcat(orignew, ".porig");
if (open(orignew, O_RDONLY) >= 0 ||
errno != ENOENT) {
fprintf(stderr, "%s: %s already exists\n",
- Cmd,
+ wiggle_Cmd,
orignew);
free(replacename);
free(orignew);
if (fd == -1) {
fprintf(stderr,
"%s: could not create temporary file for %s\n",
- Cmd,
+ wiggle_Cmd,
replacename);
free(replacename);
free(orignew);
blanks |= ByLine;
else
blanks |= ByWord;
- fl[0] = split_stream(flist[0], blanks);
- fl[1] = split_stream(flist[1], blanks);
- fl[2] = split_stream(flist[2], blanks);
+ fl[0] = wiggle_split_stream(flist[0], blanks);
+ fl[1] = wiggle_split_stream(flist[1], blanks);
+ fl[2] = wiggle_split_stream(flist[2], blanks);
if (!(blanks & WholeWord) &&
fl[1].elcnt > 50000 &&
(fl[0].elcnt > 50000 || fl[2].elcnt > 50000)) {
free(fl[1].list);
free(fl[2].list);
blanks |= WholeWord;
- fl[0] = split_stream(flist[0], blanks);
- fl[1] = split_stream(flist[1], blanks);
- fl[2] = split_stream(flist[2], blanks);
+ fl[0] = wiggle_split_stream(flist[0], blanks);
+ fl[1] = wiggle_split_stream(flist[1], blanks);
+ fl[2] = wiggle_split_stream(flist[2], blanks);
}
if (chunks2 && !chunks1)
- csl1 = pdiff(fl[0], fl[1], chunks2);
+ csl1 = wiggle_pdiff(fl[0], fl[1], chunks2);
else
- csl1 = diff(fl[0], fl[1], shortest);
- csl2 = diff_patch(fl[1], fl[2], shortest);
+ csl1 = wiggle_diff(fl[0], fl[1], shortest);
+ csl2 = wiggle_diff_patch(fl[1], fl[2], shortest);
- ci = make_merger(fl[0], fl[1], fl[2], csl1, csl2,
+ ci = wiggle_make_merger(fl[0], fl[1], fl[2], csl1, csl2,
obj == 'w', ignore, show_wiggles > 1);
- print_merge(outfile, &fl[0], &fl[1], &fl[2],
+ wiggle_print_merge(outfile, &fl[0], &fl[1], &fl[2],
obj == 'w', ci.merger, NULL, 0, 0);
if (!quiet && ci.conflicts)
fprintf(stderr,
if (stat(argv[0], &statbuf) != 0) {
fprintf(stderr,
"%s: failed to stat original file. - %s\n",
- Cmd, strerror(errno));
+ wiggle_Cmd, strerror(errno));
free(replacename);
free(orignew);
return 2;
if (fchmod(fileno(outfile), statbuf.st_mode) != 0) {
fprintf(stderr,
"%s: failed to change permission of new file. - %s\n",
- Cmd, strerror(errno));
+ wiggle_Cmd, strerror(errno));
free(replacename);
free(orignew);
return 2;
else {
fprintf(stderr,
"%s: failed to move new file into place.\n",
- Cmd);
+ wiggle_Cmd);
free(replacename);
free(orignew);
return 2;
if (!replace) {
fprintf(stderr,
"%s: -p in merge mode requires -r\n",
- Cmd);
+ wiggle_Cmd);
return 2;
}
if (argc != 1) {
fprintf(stderr,
"%s: -p in merge mode requires exactly one file\n",
- Cmd);
+ wiggle_Cmd);
return 2;
}
filename = argv[0];
f = fopen(filename, "r");
if (!f) {
fprintf(stderr, "%s: cannot open %s\n",
- Cmd, filename);
+ wiggle_Cmd, filename);
return 2;
}
- check_dir(filename, fileno(f));
- pl = parse_patch(f, NULL, &num_patches);
+ wiggle_check_dir(filename, fileno(f));
+ pl = wiggle_parse_patch(f, NULL, &num_patches);
fclose(f);
- if (set_prefix(pl, num_patches, strip) == 0) {
- fprintf(stderr, "%s: aborting\n", Cmd);
+ if (wiggle_set_prefix(pl, num_patches, strip) == 0) {
+ fprintf(stderr, "%s: aborting\n", wiggle_Cmd);
return 2;
}
for (i = 0; i < num_patches; i++) {
trace = getenv("WIGGLE_TRACE");
if (trace && *trace)
- do_trace = 1;
+ wiggle_do_trace = 1;
while ((opt = getopt_long(argc, argv,
short_options, long_options,
}
fprintf(stderr,
"%s: mode is '%c' - cannot set to '%c'\n",
- Cmd, mode, opt);
+ wiggle_Cmd, mode, opt);
exit(2);
case NON_SPACE:
continue;
}
fprintf(stderr,
- "%s: cannot select both words and lines.\n", Cmd);
+ "%s: cannot select both words and lines.\n", wiggle_Cmd);
exit(2);
case 'r':
continue;
}
fprintf(stderr,
- "%s: can only select one of -1, -2, -3\n", Cmd);
+ "%s: can only select one of -1, -2, -3\n", wiggle_Cmd);
exit(2);
case 'p': /* 'patch' or 'strip' */
if (obj && mode == 'x') {
fprintf(stderr,
"%s: cannot specify --line or --word with --extract\n",
- Cmd);
+ wiggle_Cmd);
exit(2);
}
if (mode != 'm' && !obj)
obj = 'w';
if (ispatch && outfile) {
fprintf(stderr, "%s: --output incompatible with --patch\n",
- Cmd);
+ wiggle_Cmd);
exit(2);
}
if (replace && mode != 'm') {
fprintf(stderr,
- "%s: --replace or --output only allowed with --merge\n", Cmd);
+ "%s: --replace or --output only allowed with --merge\n", wiggle_Cmd);
exit(2);
}
if (mode == 'x' && !which) {
fprintf(stderr,
- "%s: must specify -1, -2 or -3 with --extract\n", Cmd);
+ "%s: must specify -1, -2 or -3 with --extract\n", wiggle_Cmd);
exit(2);
}
if (mode != 'x' && mode != 'd' && which) {
fprintf(stderr,
"%s: -1, -2 or -3 only allowed with --extract or --diff\n",
- Cmd);
+ wiggle_Cmd);
exit(2);
}
if (ispatch && which == '3') {
fprintf(stderr,
- "%s: cannot extract -3 from a patch.\n", Cmd);
+ "%s: cannot extract -3 from a patch.\n", wiggle_Cmd);
exit(2);
}
char *before, *after;
};
-extern struct plist *sort_patches(struct plist *pl, int *np);
-extern void plist_free(struct plist *pl, int num);
-extern struct plist *parse_patch(FILE *f, FILE *of, int *np);
-extern struct stream load_segment(FILE *f, unsigned int start,
+extern struct plist *wiggle_sort_patches(struct plist *pl, int *np);
+extern void wiggle_plist_free(struct plist *pl, int num);
+extern struct plist *wiggle_parse_patch(FILE *f, FILE *of, int *np);
+extern struct stream wiggle_load_segment(FILE *f, unsigned int start,
unsigned int end);
-extern int set_prefix(struct plist *pl, int n, int strip);
-extern struct stream load_file(char *name);
-extern int split_patch(struct stream, struct stream*, struct stream*);
-extern int split_merge(struct stream, struct stream*, struct stream*,
+extern int wiggle_set_prefix(struct plist *pl, int n, int strip);
+extern struct stream wiggle_load_file(char *name);
+extern int wiggle_split_patch(struct stream, struct stream*, struct stream*);
+extern int wiggle_split_merge(struct stream, struct stream*, struct stream*,
struct stream*);
-extern struct file split_stream(struct stream s, int type);
-extern struct csl *pdiff(struct file a, struct file b, int chunks);
-extern struct csl *diff(struct file a, struct file b, int shortest);
-extern struct csl *diff_patch(struct file a, struct file b, int shortest);
-extern struct csl *diff_partial(struct file a, struct file b,
+extern struct file wiggle_split_stream(struct stream s, int type);
+extern struct csl *wiggle_pdiff(struct file a, struct file b, int chunks);
+extern struct csl *wiggle_diff(struct file a, struct file b, int shortest);
+extern struct csl *wiggle_diff_patch(struct file a, struct file b, int shortest);
+extern struct csl *wiggle_diff_partial(struct file a, struct file b,
int alo, int ahi, int blo, int bhi);
extern struct csl *worddiff(struct stream f1, struct stream f2,
struct file *fl1p, struct file *fl2p);
-extern struct csl *csl_join(struct csl *c1, struct csl *c2);
+extern struct csl *wiggle_csl_join(struct csl *c1, struct csl *c2);
struct ci {
int conflicts, wiggles, ignored;
struct merge *merger;
};
-extern int print_merge(FILE *out,
+extern int wiggle_print_merge(FILE *out,
struct file *a, struct file *b, struct file *c,
int words, struct merge *merger,
struct merge *mpos, int streampos, int offsetpos);
-extern void printword(FILE *f, struct elmnt e);
+extern void wiggle_printword(FILE *f, struct elmnt e);
-extern int isolate_conflicts(struct file af, struct file bf, struct file cf,
- struct csl *csl1, struct csl *csl2, int words,
- struct merge *m, int show_wiggles, int *wigglesp);
-extern struct ci make_merger(struct file a, struct file b, struct file c,
- struct csl *c1, struct csl *c2, int words,
- int ignore_already, int show_wiggles);
+extern int wiggle_isolate_conflicts(struct file af, struct file bf, struct file cf,
+ struct csl *csl1, struct csl *csl2, int words,
+ struct merge *m, int show_wiggles, int *wigglesp);
+extern struct ci wiggle_make_merger(struct file a, struct file b, struct file c,
+ struct csl *c1, struct csl *c2, int words,
+ int ignore_already, int show_wiggles);
-extern void die(char *reason);
-extern void check_dir(char *name, int fd);
-extern void *xmalloc(int len);
-extern int do_trace;
+extern void wiggle_die(char *reason);
+extern void wiggle_check_dir(char *name, int fd);
+extern void *wiggle_xmalloc(int len);
+extern int wiggle_do_trace;
extern int vpatch(int argc, char *argv[], int patch, int strip,
int reverse, int replace, char *outfile,
int selftest,
int ignore_blanks, int backup);
-extern char *Cmd;
+extern char *wiggle_Cmd;
extern char Version[];
extern char short_options[];
extern struct option long_options[];